import requests
from flask import session


class Crawler:
    def __init__(self):
        self.header = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
        }
        self.url = "https://festatic.estudy.cn/assets/xhx-web/home/license.png"

    def sendRequest(self):
        res = requests.get(self.url,headers=self.header)
        return res.content

    def saveFile(self):
        with open("../data/tupian.pong","wb") as f:
            f.write(self.sendRequest())

    def run(self):
        self.saveFile()

#代理ip
class DailiIp:
    def __init__(self):
        self.urlip = "https://qifu-api.baidubce.com/ip/geo/v1/district?ip=221.12.172.123"
        self.header = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
        }
        #构建代理
        self.proxies = {
            'https':'47.122.65.32:8443'
        }
    def sendid(self):
        resp =  requests.get(self.urlip,headers=self.header,proxies=self.proxies)
        print(resp.content.decode())

#视频音频合成

# if __name__ == "__main__":
    # Crawler().run()
    # DailiIp().sendid()

from moviepy.editor import *